import Vue from 'vue'
import Router from 'vue-router'
import bIndex from 'components/index'
import bHeader from '@/components/header'
import bNav from 'components/nav'
import bAnimation from 'components/navContents/animation'
import bFooter from 'components/footer'
import aContents from 'components/navContents/contents'
import space from 'components/space'
import login from 'components/login'

Vue.use(Router)

const router = new Router({
  routes: [
  	{
      path: '/',
      name: 'index',
      component: bIndex
   	},
    {
      path: '/bHeader',
      name: 'bHeader',
      component: bHeader
    },
    {
      path: '/bNav',
      name: 'bNav',
      component: bNav
    },
    {
      path: '/animation/:tid',
      name: 'bAnimation',
      component: bAnimation,
//    children:[
//    	{
//    		path:"/aContents/:tid",
//    		name:"aContents",
//    		component: aContents,
//    	}
//    ]
    },
    {
      path: '/footer',
      name: 'bFooter',
      component: bFooter
    },
    {
    	path:'/space',
    	name:'space',
    	component:space,
    	meta:{
    		requireAuth:true
    	}
    },
    {
    	path:'/login/',
    	name:'login',
    	component:login
    }
  ]
})
//全局守卫
//router.beforeEach((to,from,next)=>{
//	if(to.matched.some(record=>record.meta.requireAuth)){
//		if(localStorage.getItem("isLogin")){
//			next()
//		}else{
//			next({
//				path:'/login',
//				query: {
//					redirect:to.fullPath
//				}
//			})
//		}
//	}
//	else{
//		next()
//	}
////	console.log(to)
////	console.log(from)
//})

export default router